<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./jquery-1.12.4.min.js"></script>
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        ul,
        li {
            list-style: none;
        }
        
        .container {
            position: relative;
            width: 700px;
            height: 360px;
            border: 1px solid #000;
            margin: 50px auto;
        }
        
        .container ul li {
            height: 360px;
            top: 0;
            position: absolute;
            perspective: 50000px;
            transform-style: preserve-3d;
            transition: all 1s ease 0s;
        }
        
        .container ul li div {
            position: absolute;
            top: 0;
            left: 0;
            background-size: 700px 360px;
            width: 100%;
            height: 360px;
            background-color: transparent;
        }
        
        .container ul li div:nth-child(1) {
            background-image: url('./images/pic1.jpg');
            transform: translateZ(180px)
        }
        
        .container ul li div:nth-child(2) {
            background-image: url('./images/pic2.jpg');
            /* transform: rotateX(90deg); */
            transform: rotateX(90deg) translateZ(180px);
        }
        
        .container ul li div:nth-child(3) {
            background-image: url('./images/pic3.jpg');
            /* transform: rotateX(180deg); */
            transform: rotateX(180deg) translateZ(180px);
        }
        
        .container ul li div:nth-child(4) {
            background-image: url('./images/pic4.jpg');
            /* transform: rotateX(270deg); */
            transform: rotateX(270deg) translateZ(180px);
        }
        
        .nextPic {
            display: block;
            width: 100px;
            height: 50px;
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <div class="container">
        <ul>
            <li>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
            </li>
            <li>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
            </li>
            <li>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
            </li>
            <li>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
            </li>
        </ul>
    </div>

    <button class="nextPic">下一张</button>

    <script>
        let list = $('.container').find('li')
        let listNum = list.length;
        list.each(function(i) {
            $(this).css({
                width: 700 / listNum + "px",
                left: 700 / listNum * i + "px",
                'transition-delay': 0.1 * i + 's'
            }).children("div").css('background-position', -700 / listNum * i + 'px 0')
        })

        var tempNum = 0;
        $('.nextPic').click(() => {

            tempNum -= 90;
            list.css('transform', 'rotateX(' + tempNum + 'deg)')
        })
    </script>

</body>

</html>